﻿using System;

namespace Memento
{
    class Program
    {
        static void Main(string[] args)
        {
            Originator o = new Originator();
            o.State = "On";
            o.Show();

            //保存状态
            Caretaker c = new Caretaker();
            c.Memento = o.CreateMemento();

            o.State = "Off";
            o.Show();

            //恢复为原始状态
            o.SetMemento(c.Memento);
            o.Show();

            Console.Read();

        }
    }
}
